<?php
include('./lib/PHPMailer/class.phpmailer.php');
global $mail, $lg;
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mailHost = Email::getByName('mailhost');
$mail->Host       = strip_tags(trim($mailHost['value_vn'])); // SMTP server
//$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Port       = 25;                    // set the SMTP port for the GMAIL server

//Gmail
//$mail->SMTPDebug = 0;  // debugging: 1 = errors and messages, 2 = messages only
//$mail->SMTPAuth = true;  // authentication enabled
//$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
//$mail->Host = 'smtp.gmail.com';
//$mail->Port = 465; 

$mailUserName = Email::getByName('emailcontact');

$mail->Username   = strip_tags(trim($mailUserName['value_vn'])); // SMTP account username
$mailPass = Email::getByName('passwordcontact');
$mail->Password   = strip_tags(trim($mailPass['value_vn']));        // SMTP account password

$mailName = Email::getByName('emailcontact');
$mailUserName = Email::getByName('titlecontact');
//$mail->AddEmbeddedImage("/absolute/path/to/image.gif", 1001, 'imagename.gif');  

//$mailLogo = Email::getByName('logoemail');
//$mail->AddEmbeddedImage($mailLogo['value_vn'], 1001, $mailLogo['value_en']);
$mail->SetFrom(strip_tags(trim($mailName['value_vn'])), !empty($mailUserName['value_vn'])?$mailUserName['value_vn']:'Webmaster');
$mail->CharSet = "UTF-8"; 

//$mail->AddBCC('timkhachsan.vn@gmail.com', 'Tìm Khách Sạn');
?>